// Copyright 2020 The docker-demo Authors. All rights reserved.

// Project: docker-demo
// IDE: GoLand
// Author: fucaihe@gmail.com
// File: setting.go
// Date: 2020/8/12 10:47
// Description: 配置文件

package setting

import (
	"github.com/BurntSushi/toml"
	"github.com/pkg/errors"
)

// Setup 初始化配置
func Setup(fpath string) error {
	if fpath == "" {
		fpath = "conf/app.tml"
	}

	if _, err := toml.DecodeFile(fpath, &Config); err != nil {
		return errors.Wrap(err, "Fail to setting.Setup")
	}

	return nil
}

var (
	Config struct {
		// 系统配置
		App struct {
			Hello string `toml:"hello"`
		} `toml:"app"`
	}
)
